package com.eden.door.component;

import java.awt.Color;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.table.TableCellRenderer;

public class RowDeleteButton extends JLabel implements ActionListener, MouseListener ,
		TableCellRenderer {
	private static final long serialVersionUID = 1L;

	public RowDeleteButton() {
		this.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage(
				"image/rowdel.png")));
		this.setPreferredSize(new Dimension(40, 40));
		this.setHorizontalAlignment(CENTER);
		this.setCursor(new Cursor(Cursor.HAND_CURSOR)) ;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		System.out.println("delete");
	}

	public Component getTableCellRendererComponent(JTable table, Object value,
			boolean isSelected, boolean hasFocus, int row, int column) {
		
		if (isSelected) {
//			setBorder(BorderFactory.createLineBorder(Color.red));
		} else {
//			setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY));
		}

		setText("");

		return this;
	}

	@Override
	public void mouseClicked(MouseEvent e) {
		System.out.println("clicked ") ;
		
	}

	@Override
	public void mousePressed(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseEntered(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseExited(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}
}
